<?php


namespace App\Aspect;

use Hyperf\Di\Annotation\Aspect;
use Hyperf\Di\Aop\ProceedingJoinPoint;
use HyperfExt\Auth\Guards\JwtGuard;

/**
 * token获取用户信息切面
 * @package App\Aspect
 * @Aspect
 */
class UserAspect extends \Hyperf\Di\Aop\AbstractAspect
{
    public $classes = [
        JwtGuard::class.'::user'
    ];

    /**
     * @inheritDoc
     * @throws \Hyperf\Di\Exception\Exception
     */
    public function process(ProceedingJoinPoint $proceedingJoinPoint)
    {
        $result = $proceedingJoinPoint->process();
        unset($result['password'],$result['salt']); // 移除auth()->user()返回的密码信息;
        return $result;
    }
}